#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>

void* my_memcpy(void* dest, const void* src, size_t num)
{
	void* ret = dest;
	while (num--)
	{
		*(char*)dest = *(char*)src;
		src = (char*)src + 1;
		dest = (char*)dest + 1;
	}
	return ret;
}


void* my_memmove(void* dest, const void* src, size_t num)
{
	void* ret = dest;
	if (dest > src)
	{
		while (num--)
		{
			*(char*)dest = *(char*)src;
			src = (char*)src + 1;
			dest = (char*)dest + 1;
		}
	}
	else
	{
		while (num--)
		{
			*((char*)dest + num)= *((char*)src + num);
		}

	}
	return dest;
}

int main()
{
	int arr1[] = { 1,2,3,4,5,6,7,8,9,0 };
	int arr2[20] = { 0 };
	char* r = my_memcpy(arr2, arr1, 40);
	for (int i = 0;i < 10;i++)
	{
		printf("%d ", *r + i);
	}

	return 0;
}

